<?php
include_once('../inc/init.php');
$urlrewrite = intval($cache_settings['urlrewrite']);
$viewurl='';
switch($urlrewrite){
	case 0:
		$viewurl="view.php?tid={tid}";
	break;
	case 1:	//伪静态的方式1,程序实现
		$viewurl="?view-{tid}.html";
	break;
	case 2:	//伪静态的方式2,urlrewrite rule
		$viewurl="view-{tid}.html";
	break;
}
_header_('Content-Type:text/xml;');
print"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
$rows=$db->row_select("topics","isrecycle=0 and verifystate=0","500","id","ordertime desc");
$url=getUrlPath(-1);
$lastmod=getDateStr(time(),"dateonly",false);
print <<<EOT
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\r\n
EOT;
$i=0;
foreach($rows as $row){
$priority=1-($i++/10000);
$priority=$priority<0.6?0.6:$priority;
$priority=number_format($priority,2);
$locurl=str_replace('{tid}',$row['id'],$viewurl);
print <<<EOT
<url>
<loc>{$url}/{$locurl}</loc>
<priority>{$priority}</priority>
<changefreq>daily</changefreq>
<lastmod>{$lastmod}</lastmod>
</url>\r\n
EOT;
}
print <<<EOT
</urlset>
EOT;
?>
